package com.pxr.collectiontools;

public class Student implements Comparable<Student>{
    //属性
    private String stuName;
    private String stuNum;
    private double stuScore;

    //行为

    public Student() {
    }

    public Student(String stuName, String stuNum, double stuScore) {
        this.stuName = stuName;
        this.stuNum = stuNum;
        this.stuScore = stuScore;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuName='" + stuName + '\'' +
                ", stuNum='" + stuNum + '\'' +
                ", stuScore=" + stuScore +
                '}';
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public double getStuScore() {
        return stuScore;
    }

    public void setStuScore(double stuScore) {
        this.stuScore = stuScore;
    }


    @Override
    public int compareTo(Student stu) {
        // 比较业务逻辑i的实现
        // 默认值  默认是等于
        int i = 1;
        if(stu != null) {
            if(this.getStuScore() > stu.getStuScore()) {
                //大于
                i = 1;
            }
            if(this.getStuScore() < stu.getStuScore()) {
                //小于
                i = -1;
            }
        }
        return 1;
    }
}
